/*******************************************************************************
 * Copyright (c) 2022, 2022
 ******************************************************************************/
package com.alex.demo.springtest.factorybean;

import org.springframework.beans.factory.FactoryBean;
import org.springframework.stereotype.Component;

/**
 * @Version 1.0
 * @Author Alex
 * @Created Dec 2022/8/18 16:53
 * @Description
 *              <p>
 */
@Component
public class CarFactoryBean implements FactoryBean<Car> {

	@Override
	public Car getObject() throws Exception {
		// 此处可以根据不同的需求，产生出不同的Car对象，也就是该方法中可以加入复杂逻辑
		return new SmallCar();
	}

	@Override
	public Class<?> getObjectType() {
		return Car.class;
	}

	@Override
	public boolean isSingleton() {
		return true;
	}
}
